{layout name="public/layout" /}
{include file='yxnavbar'}


<div class="main">
    {include file='sms/sms_header'}
    <form action="" method="post" class="form-horizontal" role="form" name="form5" id="form5">
            <div class="panel panel-default" role="tabpanel">
            <div class="panel-heading">
                <span style="color: red;">*</span>基础设置
            </div>
            <div class="panel-body">
                <div class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">即时短信开关</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <label class="radio-inline">
                                <input name="open_yx_sms" value="0" {if $sms_config['open_yx_sms']!=1} checked="checked"{/if} type="radio"> 关闭
                            </label>
                            <label class="radio-inline">
                                <input name="open_yx_sms" value="1" {if $sms_config['open_yx_sms']==1} checked="checked"{/if} type="radio"> 开启<b style="color: #ff0000">【每67个字符为1条，每条0.1元】</b>
                            </label>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">暂停短信通知</label>
                        <div class="col-sm-5 col-xs-12">
                            <div class="input-group">
                                <span class="input-group-addon">通知用户</span>
                                <input type="number" class="form-control" style="min-width: 60px;"  placeholder="5"  name="sms_user_pause"  value="{$sms_config['sms_user_pause']}">
                                <span class="input-group-addon">次短信，用户未返回活动链接，将暂停此用户短信通知</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">短信通知规则</label>
                        <div class="col-sm-5 col-xs-12">
                            <div class="input-group">
                                <span class="input-group-addon">每日最多发放</span>
                                <input type="number" class="form-control" style="min-width: 20px;"  placeholder="5000"  name="sms_day_max"  value="{$sms_config['sms_day_max']}">
                                <span class="input-group-addon">条</span>
                                <span class="input-group-addon">每小时最多发放</span>
                                <input type="number" class="form-control" style="min-width: 20px;"  placeholder="1000"  name="sms_hour_max"  value="{$sms_config['sms_hour_max']}">
                                <span class="input-group-addon">条</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">短信通知名称</label>
                        <div class="col-sm-8 col-xs-12">
                            <div class="input-group">
                                <input type="text" class="form-control" style="min-width: 220px;"  placeholder="请输入店名简称、活动简称"  name="sms_notice_signname"  value="{php echo $sms_notice_signname?$sms_notice_signname:$jubf;}">
                            </div>
                            
                        </div>

                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">员工通知</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <label class="radio-inline">
                                <input name="sms_worker" value="0" {if $sms_config['sms_worker']==0} checked="checked"{/if} type="radio"> 关闭（只通知客户）
                            </label>
                            <label class="radio-inline">
                                <input name="sms_worker" value="1" {if $sms_config['sms_worker']==1} checked="checked"{/if} type="radio"> 开启（客户与员工均通知）
                            </label>
                        </div>
                    </div>
                </div>
            </div>
        </div>
            <div class="panel panel-default" role="tabpanel" style="">
                <div class="panel-heading">好友通知</div>
                <div class="panel-body" style="">
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">客户支付成功</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_self_buy" value="0" {if $sms_config['sms_self_buy']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_self_buy" value="1" {if $sms_config['sms_self_buy']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;" id="sms_self_buy_tips"    placeholder=" "  name="sms_self_buy_tips"  value="{$sms_config['sms_self_buy_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'self_buy',0);?>
                                <span class="help-block" style="display: inline;"  id="sms_self_buy_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>

                                <span  style="color: red;" id="sms_self_buy_tips_span1">{php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    {if $config['isicon']==3 || $system['is_mystery_boxes']>0 || $system['is_mystery_boxes_feichi']>0}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">好友助力</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <label class="radio-inline">
                                <input name="sms_friend_help" value="0" {if $sms_config['sms_friend_help']==0} checked="checked"{/if} type="radio"> 关闭
                            </label>
                            <label class="radio-inline">
                                <input name="sms_friend_help" value="1" {if $sms_config['sms_friend_help']==1} checked="checked"{/if} type="radio"> 开启
                            </label>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'friend_help',0);?>
                                 <span class="help-block" style="display: inline;" >信息模版：{php echo $temp_txt['sms_demo'];}<span  style="color: red;">   {php echo $temp_txt['tips'];}</span></span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">好友助力成功</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <label class="radio-inline">
                                <input name="sms_friend_help_success" value="0" {if $sms_config['sms_friend_help_success']==0} checked="checked"{/if} type="radio"> 关闭
                            </label>
                            <label class="radio-inline">
                                <input name="sms_friend_help_success" value="1" {if $sms_config['sms_friend_help_success']==1} checked="checked"{/if} type="radio"> 开启
                            </label>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'friend_help_success',0);?>
                                 <span class="help-block" style="display: inline;" >信息模版：{php echo $temp_txt['sms_demo'];}<span  style="color: red;">   {php echo $temp_txt['tips'];}</span></span>
                            </div>
                        </div>
                    </div>
                    {/if}
                    <div class="form-group">

                        <label class="col-sm-2 col-xs-12 control-label">好友购买</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_friend_buy" value="0" {if $sms_config['sms_friend_buy']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_friend_buy" value="1" {if $sms_config['sms_friend_buy']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;" id="sms_friend_buy_tips"    placeholder=" "  name="sms_friend_buy_tips"  value="{$sms_config['sms_friend_buy_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'friend_buy',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_friend_buy_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;" id="sms_friend_buy_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">好友到访</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_friend_newfans" value="0" {if $sms_config['sms_friend_newfans']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_friend_newfans" value="1" {if $sms_config['sms_friend_newfans']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_friend_newfans_tips" name="sms_friend_newfans_tips"  value="{$sms_config['sms_friend_newfans_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'friend_newfans',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_friend_newfans_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;"  id="sms_friend_newfans_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    {if $system['is_mystery_boxes']>0 || $system['is_mystery_boxes_feichi']>0}
                    <!-- 判断61领泽不支持盲盒 -->
                    {if !LINGZE_SERVER}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">新盲盒可拆</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <label class="radio-inline">
                                <input name="sms_mystery_boxes_new" value="0" {if $sms_config['sms_mystery_boxes_new']==0} checked="checked"{/if} type="radio"> 关闭
                            </label>
                            <label class="radio-inline">
                                <input name="sms_mystery_boxes_new" value="1" {if $sms_config['sms_mystery_boxes_new']==1} checked="checked"{/if} type="radio"> 开启
                            </label>
                            <div class="col-sm-12">
                                {if $config['get_mystery_boxes'] == 1}
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'mystery_boxes_new',0);?>
                                 <span class="help-block" style="display: inline;" >信息模版：{php echo $temp_txt['sms_demo'];}<span  style="color: red;">   {php echo $temp_txt['tips'];}</span></span>
                                {/if}
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'mystery_boxes_new',1);?>
                                 <span class="help-block" style="display: inline;" >信息模版：{php echo $temp_txt['sms_demo'];}<span  style="color: red;">   {php echo $temp_txt['tips'];}</span></span>
                            </div>
                        </div>
                    </div>
                    {/if}
                    {/if}
                </div>
            </div>
            {if $config['maxcountall']>1}
            <div class="panel panel-default" role="tabpanel" style="">
                <div class="panel-heading">拼团通知</div>
                <div class="panel-body" style="">
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">新成员通知</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_pintuan_new" value="0" {if $sms_config['sms_pintuan_new']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_pintuan_new" value="1" {if $sms_config['sms_pintuan_new']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_pintuan_new_tips"  name="sms_pintuan_new_tips"  value="{$sms_config['sms_pintuan_new_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'pintuan_new',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_pintuan_new_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;" id="sms_pintuan_new_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">拼团成功</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_pintuan_success" value="0" {if $sms_config['sms_pintuan_success']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_pintuan_success" value="1" {if $sms_config['sms_pintuan_success']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_pintuan_success_tips"  name="sms_pintuan_success_tips"  value="{$sms_config['sms_pintuan_success_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'pintuan_success',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_pintuan_success_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;" id="sms_pintuan_success_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            {/if}
            {if $system['ispresale']==1}
            <div class="panel panel-default" role="tabpanel" style="">
                <div class="panel-heading">预售（二选一）</div>
                <div class="panel-body" style="">
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">补款通知</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_presale"  value="0" {if $sms_config['sms_presale']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_presale" value="1" {if $sms_config['sms_presale']==1} checked="checked"{/if} type="radio"> 补款通知
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_presale" value="2" {if $sms_config['sms_presale']==2} checked="checked"{/if} type="radio"> 新品开售
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_presale" value="3" {if $sms_config['sms_presale']==3} checked="checked"{/if} type="radio"> 大卡开售
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_presale" value="4" {if $sms_config['sms_presale']==4} checked="checked"{/if} type="radio"> 活动开抢
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_presale_tips"  name="sms_presale_tips"  value="{$sms_config['sms_presale_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php
                                $temp_txt1 = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'presale',0);
                                $temp_txt2 = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'presale',1);
                                $temp_txt3 = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'presale',2);
                                $temp_txt4 = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'presale',3);
                            ?>
                                <div>
                                    <span class="help-block" style="display: inline;"   id="sms_presale_tips_span1">补款通知模版：{php echo $temp_txt1['sms_demo'];}</span>
                                    <span style="color: red;" id="sms_presale_tips_span11">{php echo $temp_txt1['tips'];}</span>
                                </div>
                                <div>
                                    <span class="help-block" style="display: inline;"   id="sms_presale_tips_span2">新品开售模版：{php echo $temp_txt2['sms_demo'];}</span>
                                    <span style="color: red;" id="sms_presale_tips_span22">{php echo $temp_txt2['tips'];}</span>
                                </div>
                                <div>
                                    <span class="help-block" style="display: inline;"  id="sms_presale_tips_span3">大卡开售模版：{php echo $temp_txt3['sms_demo'];}</span>
                                    <span style="color: red;" id="sms_presale_tips_span33">{php echo $temp_txt3['tips'];}</span>
                                </div>
                                <div>
                                    <span class="help-block" style="display: inline;"  id="sms_presale_tips_span4">活动开抢模版：{php echo $temp_txt4['sms_demo'];}</span>
                                    <span style="color: red;" id="sms_presale_tips_span44">{php echo $temp_txt4['tips'];}</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            {/if}

            {if $system['ruanjian']==5}
            <!-- 判断61领泽不支持盲盒 -->
            {if !LINGZE_SERVER}
            <div class="panel panel-default" role="tabpanel" style="">
                <div class="panel-heading">砍价</div>
                <div class="panel-body" style="">
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">帮砍提醒</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <label class="radio-inline">
                                <input name="sms_bargain_help" value="0" {if $sms_config['sms_bargain_help']==0} checked="checked"{/if} type="radio"> 关闭
                            </label>
                            <label class="radio-inline">
                                <input name="sms_bargain_help" value="1" {if $sms_config['sms_bargain_help']==1} checked="checked"{/if} type="radio"> 开启
                            </label>
                            <?php $bargain_mode = $config['bargain_friendnum']>0?0:1;?>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'bargain_help',$bargain_mode);?>
                                <!--					需要判断砍价模式老决定使用安一个  1人数  2金额-->
                                 <span class="help-block" style="display: inline;" >信息模版：{php echo $temp_txt['sms_demo'];}<span  style="color: red;">   {php echo $temp_txt['tips'];}</span></span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">砍价成功</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <label class="radio-inline">
                                <input name="sms_bargain_success" value="0" {if $sms_config['sms_bargain_success']==0} checked="checked"{/if} type="radio"> 关闭
                            </label>
                            <label class="radio-inline">
                                <input name="sms_bargain_success" value="1" {if $sms_config['sms_bargain_success']==1} checked="checked"{/if} type="radio"> 开启
                            </label>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'bargain_success',0);?>
                                 <span class="help-block" style="display: inline;" >信息模版：{php echo $temp_txt['sms_demo'];}<span  style="color: red;">   {php echo $temp_txt['tips'];}</span></span>
                            </div>
                        </div>
                    </div>
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">砍价失败</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <label class="radio-inline">
                                <input name="sms_bargain_fail" value="0" {if $sms_config['sms_bargain_fail']==0} checked="checked"{/if} type="radio"> 关闭
                            </label>
                            <label class="radio-inline">
                                <input name="sms_bargain_fail" value="1" {if $sms_config['sms_bargain_fail']==1} checked="checked"{/if} type="radio"> 开启
                            </label>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'bargain_fail',0);?>
                                 <span class="help-block" style="display: inline;" >信息模版：{php echo $temp_txt['sms_demo'];}<span  style="color: red;">   {php echo $temp_txt['tips'];}</span></span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            {/if}
            {/if}
            {if $system['lottery']==1}
            <!-- 判断61领泽不支持盲盒 -->
            {if !LINGZE_SERVER}
            <div class="panel panel-default" role="tabpanel" style="">
                <div class="panel-heading">九宫格抽奖</div>
                <div class="panel-body" style="">
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">抽奖机会增加</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <label class="radio-inline">
                                <input name="sms_lottery_new" value="0" {if $sms_config['sms_lottery_new']==0} checked="checked"{/if} type="radio"> 关闭
                            </label>
                            <label class="radio-inline">
                                <input name="sms_lottery_new" value="1" {if $sms_config['sms_lottery_new']==1} checked="checked"{/if} type="radio"> 开启
                            </label>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'lottery_new',0);?>
                                <span class="help-block" style="display: inline;" >信息模版：{php echo $temp_txt['sms_demo'];}<span  style="color: red;">   {php echo $temp_txt['tips'];}</span></span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            {/if}
            {/if}
            {if $system['fenxiao']==1}
            <div class="panel panel-default" role="tabpanel" style="">
                <div class="panel-heading">分销通知</div>
                <div class="panel-body" style="">
                    {if $system['fenxiao06'] >0 && $sms_config['sms_worker']==1}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">员工提成</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_fenxiao06" value="0" {if $sms_config['sms_fenxiao06']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_fenxiao06" value="1" {if $sms_config['sms_fenxiao06']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_fenxiao06_tips"  name="sms_fenxiao06_tips"  value="{$sms_config['sms_fenxiao06_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'fenxiao06',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_fenxiao06_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}></span>
                                <span  style="color: red;" id="sms_fenxiao06_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    {/if}
                    {if $system['selling_agent']==1}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">代理提成</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_comm_agent" value="0" {if $sms_config['sms_comm_agent']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_comm_agent" value="1" {if $sms_config['sms_comm_agent']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_comm_agent_tips"  name="sms_comm_agent_tips"  value="{$sms_config['sms_comm_agent_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'fenxiao06',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_comm_agent_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;" id="sms_comm_agent_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    {/if}
                    {if $system['fenxiao01'] >0}
                        <label class="col-sm-2 col-xs-12 control-label">一级分销</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_fenxiao01" value="0" {if $sms_config['sms_fenxiao01']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_fenxiao01" value="1" {if $sms_config['sms_fenxiao01']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_fenxiao01_tips"  name="sms_fenxiao01_tips"  value="{$sms_config['sms_fenxiao01_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'fenxiao01',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_fenxiao01_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;" id="sms_fenxiao01_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    {/if}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">二级分销</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_fenxiao02" value="0" {if $sms_config['sms_fenxiao02']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_fenxiao02" value="1" {if $sms_config['sms_fenxiao02']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_fenxiao02_tips"  name="sms_fenxiao02_tips"  value="{$sms_config['sms_fenxiao02_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'fenxiao02',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_fenxiao02_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;" id="sms_fenxiao02_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    {/if}
                    {if $system['fenxiao01'] > 2}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">三级分销</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_fenxiao03" value="0" {if $sms_config['sms_fenxiao03']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_fenxiao03" value="1" {if $sms_config['sms_fenxiao03']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_fenxiao03_tips"  name="sms_fenxiao03_tips"  value="{$sms_config['sms_fenxiao03_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'fenxiao03',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_fenxiao03_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;" id="sms_fenxiao03_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    {/if}
                    {if $system['fenxiao05'] ==1}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">阅读红包</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_fenxiao05" value="0" {if $sms_config['sms_fenxiao05']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_fenxiao05" value="1" {if $sms_config['sms_fenxiao05']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_fenxiao05_tips"  name="sms_fenxiao05_tips"  value="{$sms_config['sms_fenxiao05_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'fenxiao05',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_fenxiao05_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;" id="sms_fenxiao05_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    {/if}
                    {if $system['fenxiao08'] ==1}
                    <div class="form-group">
                        <label class="col-sm-2 col-xs-12 control-label">额外红包</label>
                        <div class="col-sm-10 col-md-10 col-lg-10 col-xs-12">
                            <div class="col-sm-3">
                                <label class="radio-inline">
                                    <input name="sms_fenxiao08" value="0" {if $sms_config['sms_fenxiao08']==0} checked="checked"{/if} type="radio"> 关闭
                                </label>
                                <label class="radio-inline">
                                    <input name="sms_fenxiao08" value="1" {if $sms_config['sms_fenxiao08']==1} checked="checked"{/if} type="radio"> 开启
                                </label>
                            </div>
                            <div class="col-sm-4">
                                <div class="input-group">
                                    <span class="input-group-addon">提示语</span>
                                    <input type="text" class="form-control" style="min-width: 220px;"    id="sms_fenxiao08_tips"  name="sms_fenxiao08_tips"  value="{$sms_config['sms_fenxiao08_tips']}">
                                </div>
                            </div>
                            <div class="col-sm-12">
                                <?php $temp_txt = \app\model\Sms::getDemoSmsInfo($system,$config,$themeid,'fenxiao08',0);?>
                                 <span class="help-block" style="display: inline;"  id="sms_fenxiao08_tips_span">信息模版：{php echo $temp_txt['sms_demo'];}</span>
                                <span  style="color: red;" id="sms_fenxiao08_tips_span1">   {php echo $temp_txt['tips'];}</span>
                            </div>
                        </div>
                    </div>
                    {/if}
                </div>
            </div>

        </form>
    <div class="form-group" style="width: 120px;position: fixed;right: 30px;bottom: 45%;z-index:1000;">
        <div class="col-sm-12">
            <input name="submit" onclick="addOrEditItem(5)" type="button" value="提交" class="btn btn-primary col-lg-2" style="width: 100px;">
        </div>
    </div>

</div>


<script type="text/javascript">
    var tips = {};
    var a_tips = {};
    function assemble(sms_tips,config){
        var key = sms_tips;
        var sms_tips = '#'+sms_tips;
        var sms_tips_name = sms_tips+'_span';
        var sms_tips_name1 = sms_tips_name +'1';
        //监听input
        var sms_tips_content = $(sms_tips).val();
        if(sms_tips_content){
            var sms_tips_content = '【'+sms_tips_content+'】';
        }
        if(tips[key]){
            //旧
            a_tips[key] = tips[key];
        }else{
            if(config){
                a_tips[key] = '【'+config+'】详情';
            }else{
                // if()
                a_tips[key] = '详情';
            }
        }
        //新
        tips[key] = sms_tips_content+'详情';

        //获取示例
        var content = $(sms_tips_name).text();
        //提示语字眼替换
        var content = content.replace(a_tips[key],tips[key]);
        //替换示例
        $(sms_tips_name).html(content);
        //统计字数
        var content_length = content.length-5;
        //统计条数
        var content_count = Math.ceil(content_length/67);
        //组装条数
        var length_count = '预计：'+content_length+'个字，'+content_count+'条;'
        //替换条数
        $(sms_tips_name1).html(length_count);

    }
    //预售（二选一）补款通知  单独写
    $("#sms_presale_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_presale_tips']}";
        var sms_presale = $("input[name='sms_presale']:checked").val();
        //监听input
        var sms_presale_tips = $('#sms_presale_tips').val();
        if(sms_presale_tips){
            var sms_presale_tips = '【'+sms_presale_tips+'】';
        }
        var key = "sms_presale_tips"+sms_presale;
        var sms_span = "#sms_presale_tips_span"+sms_presale;
        if(tips[key]){
            //旧
            a_tips[key] = tips[key];
        }else{
            if(config){
                if(sms_presale==1){
                    a_tips[key] = '【'+config+'】立即补款';
                }else if(sms_presale==2){
                    a_tips[key] = '【'+config+'】立即抢购';
                }else if(sms_presale==3){
                    a_tips[key] = '【'+config+'】您预约的';
                }else if(sms_presale==4){
                    a_tips[key] = '【'+config+'】活动开始';
                }

            }else{
                if(sms_presale==1){
                    a_tips[key] = '立即补款';
                }else if(sms_presale==2){
                    a_tips[key] = '立即抢购';
                }else if(sms_presale==3){
                    a_tips[key] = '您预约的';
                }else if(sms_presale==4){
                    a_tips[key] = '活动开始';
                }
            }
        }
        if(sms_presale==1){
            tips[key] = sms_presale_tips+'立即补款';
        }else if(sms_presale==2){
            tips[key] = sms_presale_tips+'立即抢购';
        }else if(sms_presale==3){
            tips[key] = sms_presale_tips+'您预约的';
        }else if(sms_presale==4){
            tips[key] = sms_presale_tips+'活动开始';
        }
        //获取示例
        var content = $(sms_span).text();
        //提示语字眼替换
        var content = content.replace(a_tips[key],tips[key]);
        //替换示例
        $(sms_span).html(content);
        //统计字数
        var content_length = content.length-7;
        //统计条数
        var content_count = Math.ceil(content_length/67);
        //组装条数
        var length_count = '预计：'+content_length+'个字，'+content_count+'条;'
        //替换条数
        $("#sms_presale_tips_span"+sms_presale+sms_presale).html(length_count);

    });
    //客户支付成功
    $("#sms_self_buy_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_self_buy_tips']}";
        assemble('sms_self_buy_tips',config);
    });
    //好友购买
    $("#sms_friend_buy_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_friend_buy_tips']}";
        assemble('sms_friend_buy_tips',config);
    });
    //好友到访
    $("#sms_friend_newfans_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_friend_newfans_tips']}";
        assemble('sms_friend_newfans_tips',config);
    });
    //新成员通知
    $("#sms_pintuan_new_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_pintuan_new_tips']}";
        assemble('sms_pintuan_new_tips',config);
    });
    //拼团成功
    $("#sms_pintuan_success_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_pintuan_success_tips']}";
        assemble('sms_pintuan_success_tips',config);
    });
    //员工提成
    $("#sms_fenxiao06_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_fenxiao06_tips']}";
        assemble('sms_fenxiao06_tips',config);
    });
    //代理提成
    $("#sms_comm_agent_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_comm_agent_tips']}";
        assemble('sms_comm_agent_tips',config);
    });
    //一级分销
    $("#sms_fenxiao01_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_fenxiao01_tips']}";
        assemble('sms_fenxiao01_tips',config);
    });
    //二级分销
    $("#sms_fenxiao02_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_fenxiao02_tips']}";
        assemble('sms_fenxiao02_tips',config);
    });
    //三级分销
    $("#sms_fenxiao03_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_fenxiao03_tips']}";
        assemble('sms_fenxiao03_tips',config);
    });
    //阅读红包
    $("#sms_fenxiao05_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_fenxiao05_tips']}";
        assemble('sms_fenxiao05_tips',config);
    });
    //额外红包
    $("#sms_fenxiao08_tips").on("input propertychange",function(event){
        var config = "{$sms_config['sms_fenxiao08_tips']}";
        assemble('sms_fenxiao08_tips',config);
    });
    function addOrEditItem(no) {
        let postUrl = "{php echo createWebUrl('sms',array('op' => 'sms_config','themeid'=>$themeid,'type'=>$type));}";
        let success_redirect = "{php echo createWebUrl('sms',array('op' => 'sms_config','themeid'=>$themeid,'type'=>$type));}";
        var from_no = "#form"+no;
        let formData = $(from_no).serialize();
        $.ajax({
            url:postUrl,
            dataType:'json',
            method:'post',
            data:formData,
            success:function (e) {
                let status = e.status;
                let result = e.result;
                if (status!=1){
                    layer.msg(result.msg)
                }else{
                    layer.msg(result.msg);
                    window.location.href = success_redirect;
                }
            },
            fail:function (err) {
                console.log(err)
            }
        })
    }
</script>
